﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharp1
{
    public class Car
    {
        /// <summary>
        /// 汽车引擎
        /// </summary>
        public Engine carEngine;

        /// <summary>
        /// 左前胎
        /// </summary>
        public Tyre leftFrontTyre;
        /// <summary>
        /// 右前胎
        /// </summary>
        public Tyre rightFrontTyre;
        /// <summary>
        /// 左后胎
        /// </summary>
        public Tyre leftBackTyre;
        /// <summary>
        /// 右后胎
        /// </summary>
        public Tyre rightBackTyre;

        public void Fire()
        {
            if (carEngine == null)
            {
                System.Windows.Forms.MessageBox.Show("没有引擎怎么打火");
            }
            else if (carEngine.ob == null)
            {
                System.Windows.Forms.MessageBox.Show("油箱被偷了怎么打火");
            }
            else if (carEngine.ob.Value == 0)
            {
                System.Windows.Forms.MessageBox.Show("油被拿去炒菜了");
            }
            else
            {
                carEngine.isStart = true;//已经启动成功
            }
        }

        public void Run()
        {
            carEngine.ob.Value = carEngine.ob.Value - carEngine.useOilSeconds;//消耗油量
        }

    }
}
